<template>
  <div>
    <table-where :forms="forms" @onSubmit="onSubmit"></table-where>
    <wms-table ref="tableQuery" :tableDatas="tableDatas" @confirmHandle="confirmHandle"></wms-table>
  </div>
</template>

<script setup name="待出库">
import { ref, reactive } from 'vue'
import { POSTJSON,POST } from '@/components/utils/http'
import { objAssign,MessageBox } from '@/components/utils/api'
import { useWmsGlobal } from '@/store/wmsGlobal'
const wmsGlobal = useWmsGlobal()
const tableDatas = reactive({
  body: {
    //表数据
    head: 'OutStoreDeliver',
    url: '/OutStore/getSportPage',
    params: {out_store_finish:2},
    type: 'POSTJSON'
  },
  confirm: true
})

const tableQuery = ref()

const onSubmit = () => {
  tableQuery.value.getData()
}

const forms = reactive({
  data: tableDatas.body.params,
  rules: [],
  compValue: [
    { label: '供应商', value: 'params',id:'c_id', type: 'iconinput' ,onclick: ()=>{
      wmsGlobal.getClient(forms.data.params)
      .then(data=>{
        forms.data.c_id = data.id;
        forms.data.params = data.name;
      })
    }},
    { label: '查询', type: 'button', onclick: onSubmit }
  ]
})
const confirmHandle = ({ row }) => {
  MessageBox('确认出库【' + row.out_number + '】吗', () => {
    POST('/OutStore/confirmOutStore', { id: row.id }).then(data => {
      if (data.code === 200) {
        onSubmit()
      }
    })
  })
}
</script>
